//
//  MineProfitViewController.m
//  renmingongshe
//
//  Created by macbook on 2017/11/1.
//  Copyright © 2017年 xiaodian. All rights reserved.
//

#import "MineProfitViewController.h"
#import "ProfitDetailViewController.h"

@interface MineProfitViewController ()
@property (weak, nonatomic) IBOutlet UILabel *firstLabel;
@property (weak, nonatomic) IBOutlet UILabel *ProfitLabel;
@property (weak, nonatomic) IBOutlet UILabel *leftLabel;
@property (weak, nonatomic) IBOutlet UILabel *middleLabel;
@property (weak, nonatomic) IBOutlet UILabel *rightLabel;

@end

@implementation MineProfitViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.titleLabel.text = @"分润点";
    _firstLabel.layer.borderColor = [[UIColor whiteColor]CGColor];
    _firstLabel.layer.borderWidth = 1.0f;
    [_firstLabel.layer setCornerRadius:10.0];
    _firstLabel.layer.masksToBounds = YES;
    
    [self downloadData];
}

- (void)downloadData
{
    [self.view loadingOnAnyView];
    [THWManager PostHttp:API(MineProfit) Parameters:@{@"userToken":[Utils getUserToken]} Success:^(id responseObject) {
        [self.view removeAnyView];
        if ([responseObject[@"data"] isKindOfClass:[NSDictionary class]]) {
            _ProfitLabel.text = [NSString stringWithFormat:@"%@", responseObject[@"data"][@"total_pv"]];
            _leftLabel.text = [NSString stringWithFormat:@"%@", responseObject[@"data"][@"total_pv"]];
            _middleLabel.text = [NSString stringWithFormat:@"%@", responseObject[@"data"][@"today_totalPv"]];
            _rightLabel.text = [NSString stringWithFormat:@"%@", responseObject[@"data"][@"month_totalPv"]];
        }else{
            [self.view Message:responseObject[@"msg"]];
        }
        
    } andFalse:^(NSError *error) {
        [self.view removeAnyView];
    }];
}

- (IBAction)ScoreClick:(UIButton *)sender {
    ProfitDetailViewController *detail = [[ProfitDetailViewController alloc] init];
    [self.navigationController pushViewController:detail animated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
